Pikifen/Creating particle generators
This page will guide you on how to create a particle generator for Pikifen. A particle generator is a set of information about how the engine should throw particles into the game world. Particles are small images that don't interact with the environment, like rocks flying around, clouds of gas floating by, or even the trail left behind by thrown Pikmin and leaders. Then, in-game, enemies, or obstacles, or what have you can call one of these generators in order to generate particles. Introduction A generator can tell the engine to generate one single thing, or multiple ones over an unknown amount of time. For instance, if an enemy wants to spit a puff of gas, it should generate 10 or so clouds of gas, all at once, and that's the end of it. But if an obstacle wants to continuously spit out thick smoke, it would generate gray clouds over time; it would likely spit a bunch of them every half second or so, to keep a constant stream. So the logic depends on the usage of the generator. Particles are static images, but they can move, change size, and change opacity over time, and can also be tinted by a certain color. Each generator can only emit one type of particle, but their properties (size, position, etc.) are randomly decided every time one is created, according to the generator's settings. This decision is based on the deviation properties. For instance, when a particle of size 32 is created, if the size deviation property is set to 3, that means the particle can spawn with less 3 pixels in size, more 3 pixels in size, or anything in between. 0, for any deviation property, means no deviation, naturally. The text file that has a list of all particle generators is Game_data/Misc/Particle_generators.txt. This contains all custom-made particle generators, but not particle generators created inside the engine's logic itself, for internal use. Each main block on the file is a generator. The name of the block is also the name of the generator, and the name you should refer it by when writing scripts. Base particle As stated before, each generator can only generate one type of particle. The base block inside a generator's data on the text file specifies what the particle looks like. Its size, speed, etc. can all be deviated randomly when it spawns, which is all controlled by the generator. The base particle has the following properties: * bitmap: Image to use, on the Game_data/Graphics folder. This must include the extension (e.g. Smoke.png). If empty, the particle won't use an image, but will use a colored, solid circle instead. * duration: How long the particle lives for, in seconds. The closer it is to dying, the more transparent it becomes. This means that it fades with time on its own. * friction: When a particle moves, it can slow down over time. The friction controls this. This attribute specifies the ratio of how much is lost by each second. 0 means no speed loss. * gravity: If set to something other than 0, the created particle is pulled downward each time more over time, like the effects of gravity. This isn't "down" in the game world, this is "down" on the screen, meaning the particles are pulled south, really. Negative values can make the particle rise up each time more. Don't use this to simulate actual gravity on particles, since having a subtle pull to a direction looks good, but a harsh pull southwards may make no sense. * size_grow_speed: Over time, its size increases by this much. This is measured in pixels per second. 0 means no change, and negative numbers make it shrink. * size: Starting size, in pixels. The particle must be square, and this specifies its width or height. * speed: Speed at which it moves horizontally and vertically, in pixels per second. Format: speed =